<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<script type="text/javascript">
    $(function() {
        parent.$.messager.progress('close');
        //下拉表格初始化
        $('#addDeptId').combobox({
            valueField:'id', //值字段
            textField:'name', //显示的字段
            url:'../dept/allList.html',
            panelHeight:'auto',
            required:true,
            editable:false//不可编辑，只能选择
        });

        $('#userForm').form({
            url : '../user/addOrUpdate.html',
            onSubmit : function() {
                parent.$.messager.progress({
                    title : '提示',
                    text : '数据处理中，请稍后....'
                });
                var isValid = $(this).form('validate');
                if (!isValid) {
                    parent.$.messager.progress('close');
                }
                return isValid;
            },
            success : function(result) {
                parent.$.messager.progress('close');
                result = $.parseJSON(result);
                if (result.success) {
                    parent.$.modalDialog.openner_dataGrid.datagrid('reload');//之所以能在这里调用到parent.$.modalDialog.openner_dataGrid这个对象，是因为user.jsp页面预定义好了
                    parent.$.modalDialog.handler.dialog('close');
                } else {
                    parent.$.messager.alert('错误', result.msg, 'error');
                }
            }
        });
    });

</script>
<div class="easyui-layout" data-options="fit:true,border:false">
    <div data-options="region:'center',border:false" title="" style="overflow: hidden;">
  	<!-- 验证还是jquery-validation好用，这里省事没用 -->
    <form id="userForm" method="post">
        <div class="ui-appcenterform">
            <div class="ui-form">
                <input type="hidden" name="id" id="uuid"/>
                <div class="ui-form-txt01">名字:</div>
                <div class="ui-form-item"><input name="name" type="text" placeholder="请输入名字" validType="length[3,30]" class="easyui-validatebox ui-txtinput01" data-options="required:true"/></div>
            </div>
            <div class="ui-form">
                <div class="ui-form-txt01">密码:</div>
                <div class="ui-form-item"><input name="password" type="password" placeholder="请输入密码"  validType="length[3,30]" class="easyui-validatebox ui-txtinput01" data-options="required:true"/></div>
            </div>
            <div class="ui-form">
                <div class="ui-form-txt01">年龄:</div>
                <div class="ui-form-item"><input type="text"  placeholder="请输入年龄" class="easyui-validatebox ui-txtinput01" name="age" min="1" max="120" increment="1"/></div>
            </div>
            <div class="ui-form">
                <div class="ui-form-txt01">生日:</div>
                <div class="ui-form-item"><input type="text" name="birthday" class="easyui-validatebox ui-txtinput01" onClick="WdatePicker()"/></div>
            </div>
            <div class="ui-form">
                <div class="ui-form-txt01">编号:</div>
                <div class="ui-form-item"><input type="text" class="ui-txtinput01" /></div>
            </div>
            <div class="ui-form">
                <div class="ui-form-txt01">部门:</div>
                <div class="ui-form-item"><input type="text" id="addDeptId" name="deptId" class="ui-txtinput01"/></div>
            </div>
        </div>
    </form>
    </div>
</div>